package cn.com.greatwall.oauth.service;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.social.security.SocialUserDetails;

/**
 * @Author herw
 * @Time 2022-01-05 11:16:09
 * @Version 1.0
 * @Description: TODO(用一句话描述该文件做什么)
 */
public interface GreatwallUserDetailsService extends UserDetailsService {
    /**
     * 判断实现类是否属于该类型
     * @param accountType
     * @return
     */
    boolean supports(String accountType);
    
    /**
     * 根据电话号码查询用户
     * @param mobile
     * @return
     */
    UserDetails loadUserByMobile(String mobile);
    
    /**
     * 根据用户id/openId查询用户
     * @param userId 用户id/openId
     * @return
     * @throws UsernameNotFoundException
     */
    SocialUserDetails loadUserByUserId(String userId) throws UsernameNotFoundException;
}
